﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfLib.Craft
{
    /// <summary>
    /// PartUc.xaml 的交互逻辑
    /// </summary>
    public partial class PartUc : UserControl
    {
        public string PartId
        {
            get { return this.lblId.Content.ToString(); }
            set { this.lblId.Content = value; }
        }

        public string Title
        {
            get { return this.txtTitle.Text; }
            set { this.txtTitle.Text = value; }
        }

        public PartUc ParentPart
        {
            get;
            set;
        }

        public List<PartUc> ChildParts
        {
            get;
            private set;
        }

        public Button PartButton
        {
            get { return this.btnPartInfo; }
        }

        public int Level { get; set; }

        /// <summary>
        /// 连接到子部件的线
        /// </summary>
        public List<Line> ChildLines { get; private set; }

        /// <summary>
        /// 连接到父部件的线
        /// </summary>
        public List<Line> ParentLines { get; private set; }

        public double X { get { return Canvas.GetLeft(this); } }

        public double Y { get { return Canvas.GetTop(this); } }

        public PartUc()
        {
            InitializeComponent();
            btnPartInfo.Tag = this;
            ChildParts = new List<PartUc>();
            ChildLines = new List<Line>();
            ParentLines = new List<Line>();
        }
    }
}
